package com.fin.quant.instra.rpc;

import com.fin.quant.rpc.proto.AIServiceGrpc;
import com.fin.quant.rpc.proto.AiService;
import io.grpc.stub.StreamObserver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AIServiceRpcClient {

    @Autowired
    private AIServiceGrpc.AIServiceBlockingStub stub;

    @Autowired
    private AIServiceGrpc.AIServiceStub asyncStub;

    public AiService.ChatResponse chat(AiService.ChatRequest request) {
        return stub.chat(request);
    }

    public AiService.SuggestionResponse getSuggestions(AiService.SuggestionRequest request) {
        return stub.getSuggestions(request);
    }


    public void chatStream(AiService.ChatRequest request, StreamObserver<AiService.ChatStreamResponse> responseObserver){
        asyncStub.chatStream(request, responseObserver);
    }
}
